package JavaSE.CODE.javaIO;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;

public class BufferedOutputStreamDemo {
    public static void main(String[] args) throws Exception{
        //创建
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream("D:\\fileOutput.txt"));
        //写
        for (int i = 0; i < 10; i++) {
            bufferedOutputStream.write("helloworld\r\n".getBytes());//先写入缓冲区（8k）
        }
        bufferedOutputStream.flush();//刷新到硬盘
        //关闭bos，注：在Stream关闭的时候，会默认执行flush，关闭fos
        bufferedOutputStream.close();
    }
}
